package group.sicher.core.web.validator.annotation;

import group.sicher.core.encrypt.EncryptService;
import group.sicher.core.web.validator.handler.PasswordValidatorHandler;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author Donald
 * @description
 * @date 2019-06-11
 **/
@Documented
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
@Constraint(validatedBy = PasswordValidatorHandler.class)
public @interface Password {
    /**
     * @return the regular expression to match
     */
    String regexp();

    Class<? extends EncryptService>[] encrypt() default {};

    String message() default "{constraint.default.Password.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
